<?php
/*
 * 1626cms 讀取簡歷
 * ============================================================================
 * 版權所有: 1626網絡，并保留所有權利。
 * 網站地址: http://www.1626.com；
 * ----------------------------------------------------------------------------
 * 這不是一個自由軟件！您只能在不用于商業目的的前提下對程序代碼進行修改和
 * 使用；不允許對程序代碼以任何形式任何目的的再發布。
 * ============================================================================
 */
if(!defined('IN_QISHI'))
{
	die('Access Denied!');
}
//獲取簡歷基本信息
function get_resume_all($uid){
	$baseall=array();
	$baseall['base']=get_resume_basic($uid);
	$baseall['edu']=get_resume_education($uid);
	$baseall['work']=get_resume_work($uid);
	$baseall['tran']=get_resume_training($uid);
	$baseall['spec']=get_resume_specialty($uid);
//	$baseall['other']=get_resume_other($uid);
	return $baseall;
}
//獲取簡歷基本信息
function get_resume_basic($uid){
	global $db;
	if (intval($uid)!=$uid) return false;
	$sql = "select * from ".table('resume')." where uid=".$uid;
	$lsit=$db->getone($sql);
	if ($lsit){
		$education_name=get_jobs_education_one($lsit['education']);
		$experience_name=get_jobs_experience_one($lsit['experience']);
		$lsit['experience_name']=$experience_name['categoryname'];
		$lsit['education_name']=$education_name['categoryname'];
		$lsit['resume_url']=url_rewrite('resume-show',array('id0'=>$lsit['id']));
	}
	return $lsit;
}
//獲取求職意向
function get_resume_intention($uid){
	global $db;
	if (intval($uid)!=$uid) return false;
	$sql = "select * from ".table('resume_intention')." where uid=".$uid;
	$lsit=$db->getone($sql);
	if ($lsit){
		$wage=get_jobs_wage_one($lsit['wage']);
		$lsit['wage_name']=$wage['categoryname'];
	}
	return $lsit;
}
function get_resume_intention_foremail($uid){
	global $db;
	if (intval($uid)!=$uid) return false;
	$sql = "select * from ".table('resume_intention_foremail')." where uid=".$uid;
	$lsit=$db->getone($sql);	
	return $lsit;
}

//獲取簡歷的-崗位性質
function get_resume_intention_nature($uid)
{
	global $db;
	if (intval($uid)!=$uid) return false;
	$result = $db->query("SELECT * FROM ".table('resume_intention_nature')." WHERE uid='".$uid."'");
	while($row = $db->fetch_array($result))
	{
		$category=get_jobs_nature_one($row['jid']);
		$row['jid_name']=$category['categoryname'];
		$row_arr[] = $row;
	}
	return $row_arr;
}
//獲取簡歷的意向崗位
function get_resume_intention_jobs($uid)
{
	global $db;
	if (intval($uid)!=$uid) return false;
	$result = $db->query("SELECT * FROM ".table('resume_intention_jobs')." WHERE uid='".$uid."'");
	while($row = $db->fetch_array($result))
	{
		$category=get_jobs_category_one($row['subclass']);
		$row['subclass_name']=$category['categoryname'];
		$row['subclass_ParentID']=$category['ParentID'];
		$row_arr[] = $row;
	}
	return $row_arr;
}
//獲取簡歷期望地區
function get_resume_intention_area($uid)
{
	global $db;
	$result = $db->query("SELECT * FROM ".table('resume_intention_area')." WHERE uid='".$uid."'");
	while($row = $db->fetch_array($result))
	{
		$category=get_jobs_area_one($row['jid']);
		$row['jid_name']=$category['categoryname'];
		$row_arr[] = $row;
	}
	return $row_arr;
}
//獲取簡歷的期望行業
function get_resume_intention_trade($uid)
{
	global $db;
	if (intval($uid)!=$uid) return false;
	$result = $db->query("SELECT * FROM ".table('resume_intention_trade')." WHERE uid='".$uid."'");
	while($row = $db->fetch_array($result))
	{
		$category=get_jobs_trade_one($row['jid']);
		$row['jid_name']=$category['categoryname'];
		$row_arr[] = $row;
	}
	return $row_arr;
}
//獲取技能特長
function get_resume_specialty($uid){
	global $db;	
	if (intval($uid)!=$uid) return false;
	$sql = "select * from ".table('resume_specialty')." where uid=".$uid;
	$lsit=$db->getone($sql);
	return $lsit;
}
//獲取教育經歷列表
function get_resume_education($uid)
{
	global $db;
	if (intval($uid)!=$uid) return false;
	$result = $db->query("SELECT * FROM ".table('resume_education')." WHERE uid='".$uid."'");
	while($row = $db->fetch_array($result))
	{
		$row['ways_name']=get_wayofeducation($row['ways']);
		$row_arr[] = $row;
	}
	return $row_arr;
}
//獲取 單條 教育經歷
function get_resume_education_one($id)
{
	global $db;
	if (intval($id)!=$id) return false;
	$sql = "select * from ".table('resume_education')." where id=".$id;
	$lsit=$db->getone($sql);
	return $lsit;
}
//獲取：工作經歷
function get_resume_work($uid)
{
	global $db;
	if (intval($uid)!=$uid) return false;
	$sql = "select * from ".table('resume_work')." where uid=".$uid;
	$lsit=$db->getall($sql);
	return $lsit;
}
//獲取 單條 工作經歷
function get_resume_work_one($id)
{
	global $db;
	if (intval($id)!=$id) return false;
	$sql = "select * from ".table('resume_work')." where id=".$id;
	$lsit=$db->getone($sql);
	return $lsit;
}
//獲取：培訓經歷列表
function get_resume_training($uid)
{
	global $db;
	if (intval($uid)!=$uid) return false;
	$sql = "select * from ".table('resume_training')." where uid=".$uid;
	$lsit=$db->getall($sql);
	foreach($lsit as $key=>$row){
		$category=get_jobs_education_one($row['education']);
		$row['education_name']=$category['categoryname'];
		$lsit[$key] = $row;		
	}	
	return $lsit;
}
//獲取 單條 培訓經歷
function get_resume_training_one($id)
{
	global $db;
	if (intval($id)!=$id) return false;
	$sql = "select * from ".table('resume_training')." where id=".$id;
	$lsit=$db->getone($sql);
	return $lsit;
}
//獲取形象照片
function get_resume_photo($uid)
{
	global $db;
	if (intval($uid)!=$uid) return false;
	$sql = "select * from ".table('resume_photo')." where uid=".$uid;
	$lsit=$db->getone($sql);
	return $lsit;
}
//獲取簡歷瀏覽次數
function get_resume_click($uid)
{
	global $db;
	if (intval($uid)!=$uid) return false;
	$sql = "select * from ".table('resume_click')." where uid=".$uid;
	$lsit=$db->getone($sql);
	return $lsit['click'];
}
/*
 * 邮件发送专用
 */
function get_resume_list($offset=0,$lastuid=0)
{
	global $db;
	$sql = "SELECT id,uid,email FROM " . table ( 'resume' ) . " WHERE audit=1 AND id > $lastuid ORDER BY id asc LIMIT $offset,100";
	$list = $db->getall ( $sql );
	return $list;	
}
?>
